package eip.chapter7.contentrouter;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Java representation of the hotel booking.
 * 
 * @author Tijs Rademakers
 */
public class HotelBooking implements Serializable {
	
	private static final long serialVersionUID = -551116663311619020L;
	private final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
	private Integer bookingID;
	private String hotelCity;
	private String name;
	private String address;
	private Date bookingDate;
	private RoomType roomType;
	private Boolean smoking;
	private Date arrivalDate;
	private Date checkoutDate;
	
	//--------------------------------------------
	// Constructors
	//--------------------------------------------
	
	public HotelBooking() {
	}
	
	public HotelBooking(Integer bookingID, String hotelCity, String name, String address,
			Date bookingDate, RoomType roomType, Boolean smoking, 
			Date arrivalDate, Date checkoutDate) {
		this.bookingID = bookingID;
		this.hotelCity = hotelCity;
		this.name = name;
		this.address = address;
		this.bookingDate = bookingDate;
		this.roomType = roomType;
		this.smoking = smoking;
		this.arrivalDate = arrivalDate;
		this.checkoutDate = checkoutDate;
	}
	
	//---------------------------------------------
	// Simple setters and getters
	//---------------------------------------------

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Date getArrivalDate() {
		return arrivalDate;
	}

	public void setArrivalDate(Date arrivalDate) {
		this.arrivalDate = arrivalDate;
	}

	public Date getBookingDate() {
		return bookingDate;
	}

	public void setBookingDate(Date bookingDate) {
		this.bookingDate = bookingDate;
	}

	public Integer getBookingID() {
		return bookingID;
	}

	public void setBookingID(Integer bookingID) {
		this.bookingID = bookingID;
	}

	public Date getCheckoutDate() {
		return checkoutDate;
	}

	public void setCheckoutDate(Date checkoutDate) {
		this.checkoutDate = checkoutDate;
	}
	
	public String getHotelCity() {
		return hotelCity;
	}

	public void setHotelCity(String hotelCity) {
		this.hotelCity = hotelCity;
	}	
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public RoomType getRoomType() {
		return roomType;
	}

	public void setRoomType(RoomType roomType) {
		this.roomType = roomType;
	}

	public Boolean getSmoking() {
		return smoking;
	}

	public void setSmoking(Boolean smoking) {
		this.smoking = smoking;
	}
	
	/**
	 * Constructs a <code>String</code> with all attributes
	 * in name = value format.
	 *
	 * @return a <code>String</code> representation 
	 * of this object.
	 */
	public String toString()
	{
	    final String TAB = "    ";
	    
	    return "HotelBooking ( "
	        + super.toString() + TAB
	        + "bookingID = " + this.bookingID + TAB
	        + "hotelCity = " + this.hotelCity + TAB
	        + "name = " + this.name + TAB
	        + "address = " + this.address + TAB
	        + "bookingDate = " + dateFormat.format(this.bookingDate) + TAB
	        + "roomType = " + this.roomType + TAB
	        + "arrivalDate = " + dateFormat.format(this.arrivalDate) + TAB
	        + "checkoutDate = " + dateFormat.format(this.checkoutDate) + TAB
	        + "smoking = " + this.smoking
	        + " )";
	}
}
